package createpattern.factory;

/**
 * @author seer
 * @date 2018/2/5 11:37
 */
public class FactoryPatternDemo {
    public static void main(String[] args) {
        ShapeFactory shapeFactory = new ShapeFactory();
        Shape shape1 = shapeFactory.getShape("circle");
        shape1.draw();

        Shape shape2 = shapeFactory.getShape("square");
        shape2.draw();

        System.out.println("====================");

        Circle circle = ShapeFactory.getInstance(Circle.class);
        circle.draw();

        Square square = ShapeFactory.getInstance(Square.class);
        square.draw();
    }
}
